namespace Brjnk.CoordinateSystem2D.Layers
{
    using System;
    using System.ComponentModel;
    using System.Windows;
    using System.Windows.Media.Imaging;

    /// <summary>
    /// </summary>
    public class TestPhoto : IPhoto
    {
        private static int i = 0;
        private int currentI;

        public TestPhoto()
        {
            i++;
            currentI = i;
            this.Position = new Point(i * 2, i * 2);
            if (i % 10 == 0) this.Orientation = PhotoOrientation.Clockwise90;
        }

        public System.Windows.Media.ImageSource Thumbnail
        {
            get
            {
                //PngBitmapDecoder decoder = new PngBitmapDecoder(stream.Stream, BitmapCreateOptions.None, BitmapCacheOption.Default);
                //return decoder.Frames[0];

                BitmapImage img = new BitmapImage(new Uri("file://c:/test/Nums/" + currentI % 200 + ".png"));
                return img;
            }
        }

        public System.Windows.Point Position
        {
            get;
            set;
        }

        public System.Windows.Media.ImageSource PhotoFull
        {
            get { return Thumbnail; }
        }

        public PhotoOrientation Orientation
        {
            get;
            set;
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        public bool IsVisible
        {
            get { return true; }
        }
    }
}